Skip to content

plugins: fix compilation if FLB_SQLDB (sqlite3) is disabled #10239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ThomasDevoogdt
Copy link
Contributor

@patrick-stephens
Copy link
Contributor

Let's make sure this compiles for all existing targets as well.

Would it be better to disable the features within the plugins that need the DB rather than the whole plugin @leonardo-albertovich ? It feels a bit like a large hammer, e.g. no tail input even if you don't use db. We would have to make the config options and any other usage conditional though so it may be worse.

@ThomasDevoogdt
Copy link
Contributor Author

Let's make sure this compiles for all existing targets as well.

How can it not? Currently, FLB_SQLDB is enabled by default, and will stay like that. The problem is the other way around, if not enabled, then compilation breaks.

Would it be better to disable the features within the plugins that need the DB rather than the whole plugin @leonardo-albertovich ? It feels a bit like a large hammer, e.g. no tail input even if you don't use db. We would have to make the config options and any other usage conditional though so it may be worse.

For me fine, but I would do that on a per feature basis. Perhaps just continue with this PR, and then fine-tune some features that might compile with some small fixups.

In general, it would be much better if all options are toggled in the automated tests, on one reference compilation system. Perhaps even by incremental builds. But either way, I just want to fix compilation now.

@ThomasDevoogdt
Copy link
Contributor Author

ThomasDevoogdt commented May 2, 2025

@patrick-stephens @edsiper I changed this PR so that plugins are still compiled, but without database support. I hope this answers #10239 (comment).

Tested by doing this:

cd build/
cmake -GNinja -DFLB_SQLDB=OFF ../
ninja

and

cd build/
cmake -GNinja -DFLB_PREFER_SYSTEM_LIBS=ON -DFLB_SQLDB=OFF ../
ninja

@patrick-stephens
Copy link
Contributor

Not sure if the CI failure is relevant or something else

@ThomasDevoogdt
Copy link
Contributor Author

Not sure if the CI failure is relevant or something else

I just added #ifdef FLB_HAVE_SQLDB, which is true by default, so I don't think it's relevant.

@ThomasDevoogdt
Copy link
Contributor Author

@edsiper All merge checks seems to be passing. Can you consider this PR? This will also close #9757.

Copy link
Collaborator

@leonardo-albertovich leonardo-albertovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the case of FLB_EVENT_TYPE_BLOBS this constant should not be removed if don't have database support.

In the case of filter_checklist we should issue an error if mode is set to partial and FLB_HAVE_SQLDB is not defined, we cannot accept the patch as is because it would allow fluent-bit to build but cause a silent failure which would be way worse.

In the case of in_blob since it cannot operate without a database it should be disabled in the build script.

@@ -29,7 +29,10 @@
#define FLB_EVENT_TYPE_METRICS FLB_INPUT_CHUNK_TYPE_METRICS
#define FLB_EVENT_TYPE_TRACES FLB_INPUT_CHUNK_TYPE_TRACES
#define FLB_EVENT_TYPE_PROFILES FLB_INPUT_CHUNK_TYPE_PROFILES

#ifdef FLB_HAVE_SQLDB
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this conditional, this should be handled at a different level.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will restore it, can you answer on #10239 (comment), not clear where I should add a warning to indicate that this is not supported.

@ThomasDevoogdt
Copy link
Contributor Author

In the case of FLB_EVENT_TYPE_BLOBS this constant should not be removed if don't have database support.

I can do that, but where exactly should I warn about it?
Should I add one in flb_input_blob_file_register?

In the case of filter_checklist we should issue an error if mode is set to partial and FLB_HAVE_SQLDB is not defined, we cannot accept the patch as is because it would allow fluent-bit to build but cause a silent failure which would be way worse.

Is it fine to add a warning in init_config in plugins/filter_checklist/checklist.c.

In the case of in_blob since it cannot operate without a database it should be disabled in the build script.

But why do I see then #ifdef FLB_HAVE_SQLDB checks in the in_blob plugin if it should be disabled anyway? My commit just fixed one missing #ifdef FLB_HAVE_SQLDB which was forgotten.

See: https://github.com/search?q=repo%3Afluent%2Ffluent-bit%20path%3A%2F%5Eplugins%5C%2Fin_blob%5C%2F%2F%20FLB_HAVE_SQLDB&type=code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-package-test Run PR packaging tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants